// API 响应类型
export interface ApiResponse<T> {
  code: number
  message: string
  data: T
}

// 角色类型枚举
export type RoleType = 'protagonist' | 'supporting' | 'antagonist' | 'minor'

// 数据库角色类型
export interface Character {
  id: number
  name: string
  novel_id: number
  description?: string
  personality?: string
  background?: string
  abilities?: Record<string, any>
  relationships?: Record<string, any>
  avatar_image?: string
  role_type: RoleType
  importance_level: number
  tags?: string[]
  created_at: string
  updated_at: string
  is_active: boolean
  // 前端显示用的临时字段
  favorited?: boolean
  status?: 'online' | 'busy' | 'offline'
}

// 前端显示用的简化角色类型（向后兼容）
export interface LegacyCharacter {
  id: number
  name: string
  novel: string
  role: string
  emoji: string
  color: string
  description: string
  tags: string[]
  emotion: number
  intelligence: number
  accuracy: number
  status: 'online' | 'busy' | 'offline'
  favorited: boolean
}

export interface Novel {
  id: number
  title: string
  author: string
  description?: string
  cover_image?: string
  status?: string
  chapters: number
  created_at: string
  updated_at: string
  is_active: boolean
  characters?: Character[]
  // 前端显示用的临时字段
  icon?: string
  gradient?: string
}

export interface Message {
  id: number
  type: 'user' | 'character'
  name: string
  content: string
  timestamp: Date
  likes?: number
}

export interface UserStats {
  totalChats: number
  todayChats: number
  characterUsage: Record<string, number>
  novelUsage: Record<string, number>
  favoriteCharacterIds: number[]
  lastLoginDate: string
  firstLoginDate: string
}

// API 响应类型
export type CharacterDetailResponse = ApiResponse<Character>
export type NovelListResponse = ApiResponse<Novel[]>
export type NovelDetailResponse = ApiResponse<Novel> 